package org.lmind.example.common.web.internal;

import java.util.regex.Pattern;

public class ResourcePattern {
	
	private String patternText;
	
	private String template;
	
	private Pattern pattern;

	public String getPatternText() {
		return patternText;
	}

	public void setPatternText(String patternText) {
		if (patternText == null || !patternText.equals(this.patternText)) {
			pattern = null;
		}
		this.patternText = patternText;
	}
	
	public String getTemplate() {
		return template;
	}

	public void setTemplate(String template) {
		this.template = template;
	}

	public Pattern getPattern() {
		if (patternText == null) {
			pattern = null;
		} else if (pattern == null) {
			pattern = Pattern.compile(patternText);
		}
		return pattern;
	}
}
